function Face(float X, float Z)
{
	;EA "Facing" "${X}, ${Z}"
	Face ${X} ${Z}
	FaceX:Set[${X}]
	FaceZ:Set[${Z}]
}
function StopMoving()
{
	press -release ${MOVEBACKWARD}
	press -release ${STRAFELEFT}
	press -release ${STRAFERIGHT}
	press -release ${TURNLEFT}
	press -release ${TURNRIGHT}
	press -release ${SWIMUP}
	press -release ${SWIMDOWN}
	while ${Me.IsMoving}
	{
		press "${MOVEFORWARD}"
		wait 5
	}
}
function Turn()
{
	if ${Math.Rand[10]} < 5
	{
		if ${Math.Rand[10]} < 5
		{
			;EA "Turning Left" "Begin"
			press -hold ${TURNLEFT}
			wait ${Math.Rand[3]:Inc[1]}
			press -release ${TURNLEFT}
			;EA "Turning Left" "End"
		}
		else
		{
			;EA "Turning Right" "Begin"
			press -hold ${TURNRIGHT}
			wait ${Math.Rand[3]:Inc[1]}
			press -release ${TURNRIGHT}
			;EA "Turning Right" "End"
		}
		wait 5
	}
	else
	{
		if ${Math.Rand[10]} < 5
		{
			;EA "Turning Left" "Begin"
			press -hold ${TURNLEFT}
			wait ${Math.Rand[1]:Inc[1]}
			press -release ${TURNLEFT}
			;EA "Turning Left" "End"
		}
		else
		{
			;EA "Turning Right" "Begin"
			press -hold ${TURNRIGHT}
			wait ${Math.Rand[1]:Inc[1]}
			press -release ${TURNRIGHT}
			;EA "Turning Right" "End"
		}
		wait 10
	}
}
function Strafe()
{
	if ${Math.Rand[10]} < 5
	{
		if ${Math.Rand[10]} < 5
		{
			;EA "Strafing Left" "Begin"
			press -hold ${STRAFELEFT}
			wait ${Math.Rand[3]:Inc[1]}
			press -release ${STRAFELEFT}
			;EA "Strafing Left" "End"
		}
		else
		{
			;EA "Strafing Right" "Begin"
			press -hold ${STRAFERIGHT}
			wait ${Math.Rand[3]:Inc[1]}
			press -release ${STRAFERIGHT}
			;EA "Strafing Right" "End"
		}
		wait 5
	}
	else
	{
		if ${Math.Rand[10]} < 5
		{
			;EA "Strafing Left" "Begin"
			press -hold ${STRAFELEFT}
			wait ${Math.Rand[5]:Inc[1]}
			press -release ${STRAFELEFT}
			;EA "Strafing Left" "End"
		}
		else
		{
			;EA "Strafing Right" "Begin"
			press -hold ${STRAFERIGHT}
			wait ${Math.Rand[5]:Inc[1]}
			press -release ${STRAFERIGHT}
			;EA "Strafing Right" "End"
		}
		wait 10
	}
}
function TurnStrafe()
{
	if ${Math.Rand[10]} < 5
	{
		call Strafe
	}
	else
	{
		call Turn
	}
}
function RandomShuffle()
{
	if ${Math.Rand[100]} < 1
	{
		EA "Random Shuffle" "Jump"
		call Jump
	}
	if ${Math.Rand[100]} < 2
	{
		EA "Random Shuffle" "Turnstafe"
		call TurnStrafe
	}
}
function Jump()
{
	press "space"
	wait 10
}
function:bool CheckObstacle( float X, float Z, float Y )
{
	if ${Math.Distance[${Me.X}, ${Me.Z}, ${Me.Y}, ${MoveX}, ${MoveZ}, ${MoveY}]} < 1 && ${Math.Distance[${Me.X}, ${Me.Z}, ${X}, ${Z}]} >= 5
	{
		RETURN TRUE
	}
	else
	{
		RETURN FALSE
	}
}
function Obstacle()
{
	call StopMoving
	press -hold ${MOVEBACKWARD}
	wait ${Math.Rand[1]:Inc[5]}
	press -release ${MOVEBACKWARD}
	call TurnStrafe
	press "${MOVEFORWARD}"
	wait ${Math.Rand[1]:Inc[5]}
}